import type { user } from '../../types/user'
import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore('userinfo', () => {
	// 用户信息
	const userinfo = ref<user>()
	// 设置用户，登录后使用
	const setUser = (u: user) => {
		userinfo.value = u
	}
	// 清空用户，退出后使用
	const delUser = () => {
		userinfo.value = undefined
	}
	console.log(userinfo, setUser, delUser)
	return { userinfo, setUser, delUser }
})
